
package com.example.xlzx.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.xlzx.entity.Appointment;
import com.example.xlzx.dao.AppointmentMapper;
import com.example.xlzx.entity.vo.AppointmentPageVo;
import com.example.xlzx.service.IAppointmentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 预约表 服务实现类
 * </p>
 *
 * @author 1
 * @since 2025-03-07
 */
@Service
public class AppointmentServiceImpl extends ServiceImpl<AppointmentMapper, Appointment> implements IAppointmentService {
    @Autowired
    private AppointmentMapper appointmentMapper;
    @Override
    public boolean insertAppointment(Appointment appointment) {
        return save(appointment);
    }

    @Override
    public Page<AppointmentPageVo> appointmentPage(Page<Appointment> pageParam, String phone) {
        return appointmentMapper.appointmentPage(pageParam, phone);
    }

    @Override
    public List<AppointmentPageVo> selectAllAppointment(Long userId) {
        return appointmentMapper.selectAllAppointment(userId);

    }

    @Override
    public Boolean appointmentConfig(Long appointId, Integer status) {
        return this.lambdaUpdate()
                .eq(Appointment::getId, appointId)
                .set(Appointment::getStatus, status)
                .update();
    }

    @Override
    public Page<AppointmentPageVo> appointmentDoctorPage(Long doctorId, Page<Appointment> pageParam) {
        return appointmentMapper.appointmentDoctorPage(doctorId,pageParam);
    }
}
